﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="selectcustomer.aspx.cs" Inherits="Runda.CMS.Portal.Lookup.selectcustomer" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Content/global.css" />
    <link rel="stylesheet" type="text/css" href="../Content/Dialog/Dialogs.css" />
    <link rel="stylesheet" type="text/css" href="../Content/Tree/tree.css" />
    <script type="text/javascript" src="../Content/lookup/map_LookupDialogs.js"></script>
    <script type="text/javascript">
        function win_load() {
            //Table1.focusNodeByValue(mapForm.txtBldGUID.value);
        }


        // 确定返回
        // 返回用户信息字符串：用户GUID;用户名称
        function okClick() {
            if (Table1.value == null || Table1.value == "") {
                alert("该公司下没有用户被选择！");
                return;
            }
            if (document.all("__lookup")) {
                if (document.all("__lookup").value == "1")		// 如果采用 lookup 方式打开
                {
                    var ls = new LookupItems();
                    var li = new LookupItem();

                    li.id = Table1.value;
                    li.name = "ParentId";
                    li.html = "<img class='lui' src='/Images/ico_16_8_d.gif'>" + Table1.text;
                    li.values = null;
                    li.keyValues = null;

                    ls.items.push(li);

                    window.returnValue = ls;
                }
            }
            else {
                var arrReturn;

                sReturn = Table1.value;
                sReturn = sReturn + ";" + Table1.text;              
                window.returnValue = sReturn;
            }

            window.close();
        }


        // 将复选框的值保存在文本框中，之间用 ";" 分隔
        function getCBLReasonStr() {
            var sReason = "";

            for (var i = 0; i < SltCBLReason.cells.length; i++) {
                if (SltCBLReason.rows[0].cells[i].children[0].checked) {
                    sReason += SltCBLReason.rows[0].cells[i].children[1].innerText + ";";
                }
            }
            if (sReason != "") {
                mapForm.CBLReason.value = sReason.substr(0, sReason.length - 1);
                return true;
            }
        }
		</script>    
</head>
<body>
    <form id="form1" runat="server"> 

        <input name="txtBldGUID" type="text" id="txtBldGUID" style="display: none" />
        <table width="100%" cellspacing="0" cellpadding="0" height="100%">
            <tr>
                <td class="main">
                    <table width="100%" cellspacing="0" cellpadding="0" height="100%">
                        
                        
                        <tr height="1">
                            <td align="left" style="width:40px">
                                <b style="color: #666666">客户:</b>
                            </td>
                            <td  style="width:90px">
                           <asp:TextBox runat="server" ID="customerNameOrCode"></asp:TextBox></td>
                           <td  style="width:50px"><b style="color: #666666">代理商:</b></td>
                           <td  style="width:30px"><asp:CheckBox ID="cbisAgency" runat="server" /></td>
                           <td  style="width:50px">
                           <asp:Button ID="btnQuery" runat="server" Text="查询" OnClick="query" CssClass="button"  />                    
                            </td>                             
                        </tr>                         
                        <tr>
                            <td colspan="5" class="wizBox1">
                                <div style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px; overflow: auto;width: 100%; padding-top: 5px; height: 90%">
                                
                                            <asp:Repeater ID="RepeaterUsers" runat="server" >
                                                <HeaderTemplate>
                                                    <table id="Table1" cellspacing="0" cellpadding="0" width="100%" 
                                                class="singleSelectTree">
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <tr height='20' code='1' value='<%# Eval("CustomerID") %>' text='<%# Eval("CustomerName") %>'
                                                allowselect='1' is_hide="false" onclick="Table1.clickNode(this)" ondblclick="okClick()"
                                                onmouseover='this.bgColor="#E3E9F4"' onmouseout='this.bgColor="#ffffff"'>
                                                        <td>
                                                            <span></span>
                                                            <label style="cursor: hand">
                                                            </label>
                                                            <img src='/Images/ico_16_8_d.gif'><%#Eval("CustomerName")%>
                                                        </td>
                                                    </tr>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    </table>
                                                </FooterTemplate>
                                            </asp:Repeater>
                                           
                                    <input name="repUser$txtSort" type="text" onchange="javascript:setTimeout('__doPostBack(\'repUser$txtSort\',\'\')', 0)"
                                        onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="repUser_txtSort"
                                        style="display: none;" /><input name="repUser$txtLocation" type="text" id="repUser_txtLocation" style="display: none;" />
                                </div>
                                 <webdiyer:AspNetPager ID="AspNetPager1" runat="server" CssClass="paginator" CurrentPageButtonClass="cpb" PageSize="20"
                                    CustomInfoHTML="第%CurrentPageIndex%页，共%PageCount%页，每页%PageSize%条" FirstPageText="首页"
                                    LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" ShowCustomInfoSection="Left"
                                    Width="100%" LayoutType="Table" SubmitButtonClass="but" SubmitButtonText="转到"
                                    OnPageChanged="AspNetPager1_PageChanged">
                                </webdiyer:AspNetPager>
                            </td>
                        </tr>
                    </table> 
                </td>
            </tr>
            <tr height="40">
                <td class="buttons" align="center">
                    <button style="width: 70px;" onclick="okClick()" id="btnOk" type="button">
                        确 定</button>&nbsp;&nbsp;
                    <button style="width: 70px;" onclick="parent.window.close();" type="button">
                        取 消</button>
                </td>
            </tr>
        </table>
        <input type="hidden" id="__lookup" name="__lookup" value="1">;
 
    </form>
</body>
</html>
